<%@page import="com.qc.entity.UserEntity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
UserEntity userEntity = (UserEntity)request.getSession().getAttribute("userEntity"); 


%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta charset="UTF-8">
<title>我在圈城，跟我走</title>
<link rel="shortcut icon" href="images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="<c:url value="/css/intro.css"/>">
<link rel="stylesheet" type="text/css" href="<c:url value="/swiper/swiper.min.css"/>">
<link rel="stylesheet" href="<c:url value="/bootstrap-3.3.5-dist/css/bootstrap.min.css"/>">
<link rel="stylesheet" type="text/css" href="<c:url value="/Font-Awesome-3.2.1/css/font-awesome.min.css"/>">

<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/swiper/swiper.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/bootstrap-3.3.5-dist/js/bootstrap.min.js"/>"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

</head>

<!-- <body onload="loaded(),setRemSize();"> -->
<body onload="setRemSize();" style="position: relative;">
<!--登陆弹框-->
<div class="bg">
	<div class="login">
		<h4>登录圈城</h4>
		<div class="container-fluid" style="margin-bottom: 15px; line-height: 0.4rem; margin-top:10%;">
			<div class="row">
				<div class="col-xs-3" style="padding-right: 0; text-align: center;">手机号：</div>
				<div class="col-xs-9 num" style="padding-left: 0;">
					<div class="num_text">
						<input type="text" id="userName" name='new_phone' maxlength="11"  />
						<input type="button" id="btn" value="发送验证码" />
					</div>
				</div>
			</div>
		</div>
		<div class="container-fluid">
			<div class="row">
				<div class="col-xs-3" style="padding-right: 0; text-align: center;">验证码：</div>
				<div class="col-xs-9 num" style="padding-left: 0;">
					<div class="num_text">
						<input type="text" id="phone_code" name='phone_code' />
					</div>
				</div>
			</div>
		</div>
		<div class="dl">
			<button onclick="toZanLongi();">立即登录</button>
		</div>
	</div>
</div>
<!--登陆弹框end-->
<input type="hidden" id="noncestr" />
<input type="hidden" id="timestamp" />
<input type="hidden" id="signature" />
<input type="hidden" id="appId" />
<input type="hidden" id="content2"/>
<input type="hidden" id="title"/>
<input type="hidden" id="ssId">
<input type="hidden" id="userId" value="${userEntity.userId }">

<div class="container-fluid title">
<div class="row">
<div class="col-xs-2" style="padding-top:2.8%;">
<span class="logo"><img src="<c:url value="/images/logo1.png"/>"/></span>
</div>

<div class="col-xs-6 text2">
<p style="padding-top:3%;">圈城</p><br  />
<span class="font9">我们重新发现生活的意义</span>
</div>
<div class="col-xs-4 btn" style="margin-top:3%;">
<a href="https://itunes.apple.com/cn/app/id1215236776?mt=8" onclick="">立即下载</a>
</div>
</div>
</div>

<div id="scroller_s">
<!-- 轮播图 -->


</div>


<script type="text/javascript">

var url2 = "";
var myScroll;
var _serviceURL = '/69mark';
var ss_id = "";

$(function(){
    
    var toUrl = "http://www.69mark.com/69mark/toUrlIntro2.do";
    var ssId = _geturlparam('ssId');
    ss_id = ssId;
    var url2 = location.href.split('#')[0];
    var pointNumber = $("#pointNumber").val();
    var userId = $("#userId").val();
    if (userId == "") {
    	userId = 0;
    }
    var b = url2.split("?");
    var url = toUrl + "?"+ b[1];
    url2 = url;
    url =  encodeURIComponent(url);
    
    $.ajax({
        type : "POST",
        url : _serviceURL+"/toUrlIntro.do",
        cache : false,
        //async: false,
        data : "ssId="+ssId+"&url="+url+"&userId="+userId,
        dataType : 'json',
        success : function(data) {
        	
        	if (data == "2") {
        		window.location.href = _serviceURL+"/delete.html";
        	}else {
        		
	            var result = "";
	            
	            //result = '<div id="scroller">';
	            result += '<div class="width_640">';
	            result += '<div class="swiper-container">';
	            result += '<div class="swiper-wrapper">';
	            result += '<div class="swiper-slide"><img src="http://qiniu.images.69mark.com/'+data.coverUrl+'"></div>';
	            result += '</div>';
	            result += '<div class="swiper-pagination"><h4>'+data.title+'</h4></div>';
	            result += '</div>';
	            
	            result += '<div class="container-fluid intro_peo">';
	            result += '<div class="row">';
	           	result += '     <div class="col-xs-3">';
	          	result += '       <p class="font1"><img src="http://qiniu.images.69mark.com/'+data.avatar+'" /></p>';
	            result += '    </div>';
	            result += '    <div class="col-xs-6" style="padding-left: 0;">';
	            result += '        <h4>'+data.nickname+'</h4>';
	            result += '       <p class="font3"><span>'+data.time+'天前</span>&nbsp;&nbsp;<span>浏览'+data.readCount+'</span></p>';
	            result += ' 	</div>';
	            
	            if (data.pointState >0) {
	            	result += '    <div class="col-xs-2 dianzan" onclick="dianzan();" style="padding-left: 0; margin-left:-6px">';
                    result += '       <p><span>'+data.pointNumber+'</span><span>赞</span></p>';
                    result += '     </div>';
	            }else {
	            	 
	                 result += '    <div class="col-xs-2 weidianzan" onclick="dianzan();" style="padding-left: 0; margin-left:-6px">';
                     result += '       <p><span>'+data.pointNumber+'</span><span>赞</span></p>';
                     result += '     </div>';
	            }
	           
	            result += '</div>';
	            result += '</div>';
	            result += '<div class="line"></div>';
	            
	            result += '<div class="container-fluid">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-12 xing">';
	            result += '<span>TA的时薪：<i>'+data.money+'元／时</i></span>';
	            result += '<span>TA的星级：';
		            if (data.grade * 2 == 0.0) {
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            
		            if (data.grade * 2 == 1.0) {
		                result += '<img src="images/xingxing_banxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            
		            if (data.grade * 2 == 2.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            
		            if (data.grade * 2 == 3.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_banxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            
		            if (data.grade * 2 == 4.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            
		            if (data.grade * 2 == 5.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_banxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            if (data.grade * 2 == 6.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            if (data.grade * 2 == 7.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_banxin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            if (data.grade * 2 == 8.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_kongxin.png" />';
		            }
		            if (data.grade * 2 == 9.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_banxin.png" />';
		            }
		            if (data.grade * 2 == 10.0) {
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />&nbsp;';
		                result += '<img src="images/xingxing_shixin.png" />';
		            }
	            result += '</span>';
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            result += '<div class="line"></div>';
	            
	            //用户足迹
	            result += '<div class="container-fluid">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-12 zuji">';
	            result += '<span><img src="images/zuji.png" /></span>';
	            result += '<span>';
	            for (var j =0 ; j<data.listFootprint.length;j++) {
	            	 result += '<img src="http://qiniu.images.69mark.com/'+data.listFootprint[j].avatar+'" />';
	            }
	            result += '</span>';
	            
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            result += '<div class="line2"></div>';
	            
	            result += '<div class="container-fluid intro_txt">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-4 shop_left">';
	            if (data.image == "" ) {
	            	result += '<img src="images/fenxiangmoren.png" />';
	            }else {
	                result += '<img src="http://qiniu.images.69mark.com/'+data.image+'" />';
	            }
	           
	            result += '</div>';
	            result += '<div class="col-xs-8 shop_right" style="padding-left: 0;">';
	            result += '<p><span><img src="images/shop.png" /></span><span>'+data.shopMark+'</span></p>';
	            result += '<p><span><img src="images/didian.png" /></span><span>地址：'+data.shopCity+''+data.shopDistrict+''+data.shopAddress+' </span></p>';
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            result += '<div class="line2"></div>';
	        
	            result += '<div class="container-fluid intro_txt">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-12">';
	            result += data.ssContent;
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            
	            result += '<div class="container-fluid intro_txt no2">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-12">';
	            result += '<p class="font7"><img id="img" src="images/myspeciality.png" /></p>';
	           
	            result += '<p>';
		            var tag = data.tag.split(",");
		            var count = 0;
		            var num = tag.length-1;
		            for (var i =0 ;i<tag.length;i++) {
		                result += '<span class="font8">'+tag[i]+'</span>';
		                
		                if (i == 2 || i == 5 || i == 8) {
		                    result += '</p>';
		                    
		                    result += '<p>';
		                }
		                
		                if (count == num) {
		                    result += '</p>';
		                }
		                count = count +1;
		            }
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            
	            result += '</div>';
	            
	            result += '<div class="container-fluid intro_txt no3" style="margin-bottom: 0px">';
	            result += '<div class="row">';
	            result += '<div class="col-xs-12">';
	            result += '<a href="https://itunes.apple.com/cn/app/id1215236776?mt=8">下载圈城&nbsp;了解更多</a>';
	            result += '</div>';
	            result += '</div>';
	            result += '</div>';
	            //result += '</div>';
	            
	            $("#noncestr").val(data.noncestr);
	            $("#timestamp").val(data.timestamp);
	            $("#signature").val(data.signature);
	            $("#appId").val(data.appId);
	            $("#title").val(data.title);
	            $("#ssId").val(data.ssId);
	            
	            if (data.content2 != null ) {
	                $("#content2").val(data.content2);
	            }else {
	                $("#content2").val(data.shopCity+''+data.shopDistrict+''+data.shopAddress);
	            }
	            
	            $("#scroller_s").html(result);
	            
	            /*lunbo*/
	            var swiper = new Swiper('.swiper-container');
	            /*navs*/
	            var swiper = new Swiper('.swiper-container1', {
	            pagination: '.swiper-pagination1',
	            paginationClickable: true
	            });
	            var swiper = new Swiper('.swiper-container3');
	            
	            var noncestr = $("#noncestr").val();
	            var timestamp = $("#timestamp").val();
	            var signature = $("#signature").val();
	            var appId = $("#appId").val();
	            var content2 = $("#content2").val();
	            var title = $("#title").val();
	            var avatar = 'http://qiniu.images.69mark.com/'+data.avatar+'';
	            //test branch version1
	            wx.config({
	                debug: false,
		            appId: ''+appId+'',
		            timestamp: ''+timestamp+'',
		            nonceStr: ''+noncestr+'',
		            signature: ''+signature+'',
		            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
	            });
	            
	            wx.ready(function () {
	                wx.onMenuShareTimeline({
	                title: ''+title+'', // 分享标题
	                link: ''+url2+'', // 分享链接
	                imgUrl: ''+avatar+'', // 分享图标
	                success: function () {
	                    // 用户确认分享后执行的回调函数
	                },
	                cancel: function () {
	                    // 用户取消分享后执行的回调函数
	                },
	                fail: function (res) {
	                }
	            });
	             wx.onMenuShareAppMessage({
		                title: ''+title+'', // 分享标题
		                desc: ''+content2+'', // 分享描述
		                link: ''+url2+'', // 分享链接
		                imgUrl: ''+avatar+'', // 分享图标
		                type: 'link', // 分享类型,music、video或link，不填默认为link
		                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
		                success: function () {
		                    // 用户确认分享后执行的回调函数
		                },
		                cancel: function () {
		                    // 用户取消分享后执行的回调函数
		                }
		            });
	            });
	            
        	}
            
        }
    })
    
})



var _geturlparam = function(name) {
    if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)'))
        .exec(location.search))
    return decodeURIComponent(name[1]);
};

setRemSize();
//1.首次加载的时候，计算rem赋值给根元素里面的font-size。
//2.当用户更改浏览器宽度自动获取屏幕宽度，再计算rem赋值给根元素里面的font-size
window.addEventListener("resize",setRemSize,false);
function setRemSize(){
    //获取rem值    rem =100 * (屏幕宽度 / 设计稿宽度) +"px";
    var _clientWidth=100*(document.documentElement.clientWidth / 576) + "px";
    //判断，是否屏幕宽度大于设计稿宽度
    if (document.documentElement.clientWidth >= 576) {
        //如果是，用设计稿的宽度作为rem的值赋给根元素的font-size
        document.documentElement.style.fontSize="100px";
    } else {
        //如果不是，将得到的rem值赋给根元素的font-size
        document.documentElement.style.fontSize=_clientWidth;
    }
};

$('#btn').click(function(){
    
    var btn = $(this);
    btn.attr("disabled", "disabled").addClass("dis");
    var time = 60000;
    var time2 = setInterval(function() {
        time -= 1000;
        if ((time / 1000) == 0) {
            btn.val("重新发送");
            window.clearInterval(time2);
            btn.removeAttr("disabled").removeClass("dis");
        }
        else {
            btn.val("重新发送(" + time / 1000 + ")");
        }

    }, 1000);
    
   var url = _serviceURL+"/toSenCode.do";
    var regPhone = /^1([3578]\d|4[57])\d{8}$/;
    var userName = $("#userName").val();
    
    if (userName !=null &&  regPhone.test( userName )) {
        $.post(url,{'userName':userName},function(data){
            if (data == "1") {
            	//window.location.href = "/toUrlIntro2.do";
            }else{
                alert('短信发送失败。');
                btn.val("重新发送");
                window.clearInterval(time2);
                btn.removeAttr("disabled").removeClass("dis");
            }
        })
    }else {
        alert("填写正确手机号");
        btn.val("重新发送");
        window.clearInterval(time2);
        btn.removeAttr("disabled").removeClass("dis");
    }
})

//点赞弹出登陆框
function dianzan(){
    var userId = $("#userId").val();
    
    if (userId == ""){
    	$(".bg").show();
    }
    
}

//登录
function toZanLongi(){
	
	var ssId = $("#ssId").val();
	var userName = $("#userName").val();
	var phone_code = $("#phone_code").val();
	
	$.ajax({
        type : "POST",
        url : _serviceURL+"/toUserLongin.do",
        cache : false,
        data : "ssId="+ssId+"&userName="+userName+"&phone_code="+phone_code,
        dataType : 'json',
        success : function(data) {
            if (data == "1") {
                $(".bg").hide();
                window.location.href = _serviceURL+"/toUrlIntro2.do?ssId="+ss_id;
            }else {
                alert("验证码错误！");
            }
        }
     })
	
}

</script>

</body>
</html>